package hash

import (
	"crypto/md5"
	"crypto/sha256"
	"encoding/hex"
)

func GenerateAppSecretHash(key, secret, salt string) string {
	input := []byte(key + "." + secret)
	sum := []byte(salt)
	hash := md5.New()
	hash.Write(input)
	bytes := hash.Sum(sum)
	return hex.EncodeToString(bytes)
}

func Shapwd(password, salt string) string {
	bytes := []byte(password)
	hash := sha256.New()
	bytes = append(bytes, salt...)
	hash.Write(bytes)
	hashedPasswordBytes := hash.Sum(nil)
	return hex.EncodeToString(hashedPasswordBytes)
}
